package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Student4;
import com.ruoyi.system.service.IStudent4Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 学生表4Controller
 * 
 * @author ruoyi
 * @date 2025-02-13
 */
@RestController
@RequestMapping("/system/student4")
public class Student4Controller extends BaseController
{
    @Autowired
    private IStudent4Service student4Service;

    /**
     * 查询学生表4列表
     */
    @PreAuthorize("@ss.hasPermi('system:student4:list')")
    @GetMapping("/list")
    public TableDataInfo list(Student4 student4)
    {
        startPage();
        List<Student4> list = student4Service.selectStudent4List(student4);
        return getDataTable(list);
    }

    /**
     * 导出学生表4列表
     */
    @PreAuthorize("@ss.hasPermi('system:student4:export')")
    @Log(title = "学生表4", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Student4 student4)
    {
        List<Student4> list = student4Service.selectStudent4List(student4);
        ExcelUtil<Student4> util = new ExcelUtil<Student4>(Student4.class);
        util.exportExcel(response, list, "学生表4数据");
    }

    /**
     * 获取学生表4详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:student4:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(student4Service.selectStudent4ById(id));
    }

    /**
     * 新增学生表4
     */
    @PreAuthorize("@ss.hasPermi('system:student4:add')")
    @Log(title = "学生表4", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Student4 student4)
    {
        return toAjax(student4Service.insertStudent4(student4));
    }

    /**
     * 修改学生表4
     */
    @PreAuthorize("@ss.hasPermi('system:student4:edit')")
    @Log(title = "学生表4", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Student4 student4)
    {
        return toAjax(student4Service.updateStudent4(student4));
    }

    /**
     * 删除学生表4
     */
    @PreAuthorize("@ss.hasPermi('system:student4:remove')")
    @Log(title = "学生表4", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(student4Service.deleteStudent4ByIds(ids));
    }
}
